<?php
require(dirname(__FILE__) . '/includes/init.php');
if($_REQUEST['tid']){
	$sql = "select * from ".$ecs->table('template')." where template_id='".$_REQUEST['tid']."'";
	$temp = $db->getRow($sql);
}
if($_REQUEST['act']=='act_msg'){
	if(empty($_REQUEST['template_id'])){
		$db->query("insert into ".$ecs->table('template')." (title,content) values ('".$_REQUEST['title']."','".$_REQUEST['content']."')");
	}else{
		$db->query("update ".$ecs->table('template')." set title='".$_REQUEST['title']."',content='".$_REQUEST['content']."'");
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理中心 - 短信格式 </title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
</head>
<body>
 
<h1>
<span class="action-span"><a href="orders.php">订单列表</a></span>
<span class="action-span1"><a href="index.php?act=main">管理中心</a> </span><span id="search_id" class="action-span1"> - 短信格式 </span>
<div style="clear:both"></div>
</h1> 
<div class="tab-div">
    <div id="tabbody-div">
      <form enctype="multipart/form-data" action="" method="post" name="theForm">
        <table width="80%" id="general-table" align="center">
          <tr>
            <td class="label">标题：</td>
            <td><input type="text" name="title" value="<?php echo $temp['title'];?>"></td>
          </tr>
		  <tr>
            <td class="label">短信：</td>
            <td><textarea name="content" cols="80" rows="5"><?php echo $temp['content'];?></textarea></td>
          </tr>
        </table>
 
        <div class="button-div">
          <input type="hidden" name="template_id" value="<?php echo $_GET['template_id'];?>" />
                    <input type="submit" value=" 确定 " class="button" />
          <input type="reset" value=" 重置 " class="button" />
        </div>
        <input type="hidden" name="act" value="act_msg" />
      </form>
    </div>
</div>
</body>
</html>